# -*- coding: utf-8 -*-
# Author: xiantingDeng
# File: 06_递归.py
# Time: 22:09

# 如果递归的时候没有结束就会造成死循环
#
# 阶乘
# 5! = 5*4*3*2*1
'''
i = 1
result = 1
while i<= 4:
    result *= i
    i += 1
print(result)
'''


# 5! =>5*4!
# 4! => 4*3!
'''
def getNum(num):
    if num > 1:
        num *= getNum(num-1)
    else:
        return num
    return num


if __name__ == '__main__':
    print(getNum(100))


# 1+ ~100
num = 0
for i in range(100+1):
    num += i
print(num)


def nums(n):
    if n < 100:
        return n + nums(n +1)
    else:
        return n

if __name__ == '__main__':
    print(nums(0))
'''
